﻿using System;

namespace _45.委托
{
    class Program
    {
        //delegate delegate delegate delegate delegate delegate delegate delegate delegate delegate delegate delegate delegate delegate delegate delegate delegate 
        //没有返回值的委托
        public delegate void yao();
        //有返回值的委托
        public delegate int yao1();
        //有参数的委托
        public delegate void yao2(int a,string b);
        //有参数有返回值的委托
        public delegate string yao3(int a, string b);
        //
        static void Main(string[] args)
        {
            //没有返回值的委托
            //yao ui = new yao(Run);
            //ui += Run1;
            //ui();
            //有返回值的委托
            //yao1 a = new yao1(Run2);
            //a += Run3;
            //Console.WriteLine(a());
            //有参数的委托
            //yao2 a = new yao2(Run4);
            //a(10, "速度是");
            //有参数有返回值的委托
           // yao3 a = new yao3(Run5);
           //string b= a(1000, "速度是");
           // Console.WriteLine(b);
        }
        public static void Run()
        {
            Console.WriteLine("跑起来了");
        }
        public static void Run1()
        {
            Console.WriteLine("跑起来了+1");
        }
        public static int Run2()
        {
            return 100;
        }
        public static int Run3()
        {
            return 1000;
        }
        public static void Run4(int a,string b)
        {
            Console.WriteLine(b+a);
        }
        public static string Run5(int a,string b)
        {
            return b + a.ToString();
        }
    }
}
